﻿var currentId = 0;
$(document).ready(function () {

    $(".same1").delegate(".auhor", "click",
            function () {

                var isshow = $(this).parents(".same1").find(".concent:first").css("display") != "none";
                $(".same1").children(".concent").hide();
                if (isshow) {
                    $(this).parents(".same1").find(".concent").slideUp("fast");
                }
                else {
                    $(this).parents(".same1").find(".concent").slideDown("fast");
                }
            }
        );

    $(".leafNode").delegate("a", "click",
            function () {
                if ($(this).attr("isleaf") == 'True') {
                    $(".leafNode a").removeClass();
                    $(this).addClass("current");
                    currentId = $(this).attr("id");
                }
            }
        );
});




function showDiv(c) {

    $(".leafNode a:[id='" + c + "']").parents(".same1").find("a:first").click();
    $(".leafNode a:[id='" + c + "']").click();

}

var leftState = 1;
function ToggleLeft() {
    jQuery.ajax({

        dataType: "text",
        async: true,
        data: { cmd: 5000, st: Math.random(), state: (leftState == 1 ? 0 : 1) },
        url: "/ajax/AjaxGet.ashx",
        success: function (data) {
            leftState = (leftState == 1 ? 0 : 1);
            jQuery("#leftstate_img").attr("src", leftState == 1 ? "img/shafe1.png" : "img/shafe.png")

            jQuery("#lefttd").fadeToggle();
        }
    });
}


function goTo(url, c) {
    // if (c <= 0) return url;
    if (url.indexOf("?") > 0) {

        if (url.indexOf("c=") > 0 || url.indexOf("C=") > 0) {

            window.location = url.replace(/[cC]=(\d)+/i, "c=" + c);
        }
        else {
            window.location = url + "&c=" + c;
        }

    }
    else {
        window.location = url + "?c=" + c;
    }
}